package com.wqiuqiu.common.annotation;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class NullButEmptyConstraintValidator implements ConstraintValidator<NullButEmpty, String> {
    String val = null;
    @Override
    public void initialize(NullButEmpty constraintAnnotation) {
        val = constraintAnnotation.values();
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        return null == value || value.length() > 0;
    }
}
